// 在转换时添加前导零
const addLeadingZero = (number) => {
    return number < 10 ? "0" + number : number;
};
export const filterDate = (date) => {
    // 将日期转换为年月日格式
    const givenYear = date.getFullYear();
    const givenMonth = date.getMonth() + 1; // 月份从0开始计数，所以要加1
    const givenDay = date.getDate();

    return (
        givenYear +
        "-" +
        addLeadingZero(givenMonth) +
        "-" +
        addLeadingZero(givenDay)
    );
};


